{{template "ng/base/head" .}}
{{template "ng/base/header" .}}
<div id="admin-wrapper">
    <div id="setting-wrapper" class="main-wrapper">
        <div id="admin-setting" class="container clear">
            {{template "admin/nav" .}}
            <div class="grid-4-5 left">
                <div class="setting-content">
                    {{template "ng/base/alert" .}}
                    <div id="setting-content">
                        <div class="panel panel-radius">
                            <div class="panel-header">
                                <strong>{{.i18n.Tr "admin.users.edit_account"}}</strong>
                            </div>
                            <form class="form form-align panel-body" id="user-profile-form" action="{{AppSubUrl}}/admin/users/{{.User.Id}}" method="post" data-delete-url="{{AppSubUrl}}/admin/users/{{.User.Id}}/delete">
					            {{.CsrfTokenHtml}}
                                <div class="field">
                                    <label class="req">{{.i18n.Tr "admin.users.auth_source"}}</label>
                                    <select id="login-type" name="logintype">
                                        <option value="0-0">{{.i18n.Tr "admin.users.local"}}</option>
									    {{$tp := .User.LoginSource}}
									    {{range $key, $val := .LoginSources}}
					  					<option value="{{$val.Type}}-{{$val.Id}}"{{if eq $val.Id $tp}} selected{{end}}>{{$val.Name}}</option>
					  					{{end}}
                                    </select>
                                </div>
                                <div class="field">
                                    <label for="loginname">{{.i18n.Tr "admin.users.auth_login_name"}}</label>
                                    <input class="ipt ipt-large ipt-radius {{if .Err_LoginName}}ipt-error{{end}}" id="loginname" name="loginname" value="{{.User.LoginName}}" />
                                </div>
                                <div class="field">
                                    <label>{{.i18n.Tr "username"}}</label>
                                    <label class="text-left">{{.User.Name}}</label>
                                </div>
                                <div class="field">
                                    <label class="req" for="email">{{.i18n.Tr "email"}}</label>
                                    <input class="ipt ipt-large ipt-radius {{if .Err_Email}}ipt-error{{end}}" id="email" name="email" type="email" value="{{.User.Email}}" required/>
                                </div>
                                <div class="field pwd">
                                    <label for="password">{{.i18n.Tr "password"}}</label>
                                    <input class="ipt ipt-large ipt-radius {{if .Err_Password}}ipt-error{{end}}" id="password" name="password" type="password" />
                                </div>
	                            <div class="field">
	                                <label for="website">{{.i18n.Tr "settings.website"}}</label>
	                                <input class="ipt ipt-large ipt-radius {{if .Err_Website}}ipt-error{{end}}" id="website" name="website" type="url" value="{{.User.Website}}" />
	                            </div>
	                            <div class="field">
	                                <label for="location">{{.i18n.Tr "settings.location"}}</label>
	                                <input class="ipt ipt-large ipt-radius {{if .Err_Location}}ipt-error{{end}}" id="location" name="location" type="text" value="{{.User.Location}}" />
	                            </div>
	                            <div class="field">
	                                <label for="gravatar-email">Gravatar {{.i18n.Tr "email"}}</label>
	                                <input class="ipt ipt-large ipt-radius {{if .Err_Avatar}}ipt-error{{end}}" id="gravatar-email" name="avatar" type="text" value="{{.User.AvatarEmail}}" />
	                            </div>
	                            <div class="field">
	                                <label></label>
			                        <input type="checkbox" name="active" {{if .User.IsActive}}checked{{end}}>
			                        <strong>{{.i18n.Tr "admin.users.is_activated"}}</strong>
                                    <br>
                                    <label></label>
                                    <input type="checkbox" name="admin" {{if .User.IsAdmin}}checked{{end}}>
                                    <strong>{{.i18n.Tr "admin.users.is_admin"}}</strong>
                                    <br>
                                    <label></label>
                                    <input type="checkbox" name="allow_git_hook" {{if .User.AllowGitHook}}checked{{end}}>
                                    <strong>{{.i18n.Tr "admin.users.allow_git_hook"}}</strong>
	                            </div>
					            <div class="field">
					                <label></label>
                                	<button class="btn btn-green btn-large btn-radius">{{.i18n.Tr "admin.users.update_profile"}}</button>
					                &nbsp;&nbsp;&nbsp;&nbsp;
					                <button class="btn btn-large btn-red btn-radius" id="delete-account-btn" href="#delete-account-modal">{{.i18n.Tr "admin.users.delete_account"}}</button>
					            </div>
                                <div class="white-popup-block mfp-hide" id="delete-account-modal">
                                    <h1 class="text-red">{{.i18n.Tr "settings.delete_account_title"}}</h1>
                                    <p>{{.i18n.Tr "settings.delete_account_desc"}}</p>
                                    <br>
                                    <button class="btn btn-red btn-large btn-radius" id="delete-account-submit">{{.i18n.Tr "settings.continue"}}</button>
                                    <button class="btn btn-large btn-radius popup-modal-dismiss">{{.i18n.Tr "settings.cancel"}}</button>
                                </div>
							</form>
            			</div>
        			</div>
				</div>
			</div>
		</div>
	</div>
</div>
{{template "ng/base/footer" .}}
